package bean
{
	import mx.collections.ArrayCollection;

	[RemoteClass(alias="com.bean.Person")]
	[Bindable]
	public class Person
	{
		public static const ADMIN:int=1;
		public static const NORMAL:int=2;

		public var id:Number;
		public var name:String;
		public var userName:String;
		public var password:String;
		public var level:int;

		public static function isUserNameRepeat(ac:ArrayCollection, userName:String, id:Number):Boolean
		{
			var flag:Boolean=false;
			if (ac != null && ac.length > 0)
			{
				for each (var person:Person in ac)
				{
					if (person.userName == userName && (!isNaN(person.id) && person.id != id))
					{
						flag=true;
					}
				}
			}
			return flag;
		}

		public static const LEVEL_AC:ArrayCollection=new ArrayCollection([{code: 2, value: "普通员工"}, {code: 1, value: "管理员"}]);
	}
}